package com.example.demo.controller.zl;
//import com.example.uu.entity.zl.SysUser;
//import com.example.uu.service.zl.SysuserService;
import com.example.demo.entity.Permission;
import com.example.demo.entity.User;
import com.example.demo.service.zl.PermissionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
//import org.apache.catalina.User;
//import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Api("课程管理") //
@RestController //
public class PermissionCOntroller {
    @Autowired
    PermissionService permissionService;
    @RequestMapping(value = "FINDALL", method = RequestMethod.POST)
    @ApiOperation("查询")
    public List<Permission> FINDALL() {
        List<Permission> userList = permissionService.FINDALL();
        return userList;
    }
    @RequestMapping(value = "findByName",method = RequestMethod.POST)
    @ApiOperation("用户姓名查")
    public List<Permission> findByName(String name){
        List<Permission> userList= permissionService.findByName(name);
        return userList;
    }
    @RequestMapping(value = "insertUser",method = RequestMethod.POST)
    @ApiOperation("添加用户")
    public List<Permission> insert(String name,String descripion,String url,String  pid,String perms,int type, String icon,int order_num){
        List<Permission> userList = permissionService.insert(name,descripion,url,pid,perms,type,icon,order_num);
        return userList;
    }
    @RequestMapping(value = "deleteUser",method = RequestMethod.POST)
    @ApiOperation("删除用户")
    public int deleteUser(int id){
        int single = permissionService.delete(id);
        return single;
    }
    @RequestMapping(value = "updateUser",method = RequestMethod.POST)
    @ApiOperation("更新用户")
    public List<Permission> update(int id,String name,String descripion,String url,String  pid,String perms,int type, String icon,int order_num){
        List<Permission> userList = permissionService.update(id,name,descripion,url,pid,perms,type,icon,order_num);
        return userList;
    }
}



